//引入axios封装方法
import http from '@/axios';
//引入jsonp
import jsonp from '@/jsonp';


//******************统一接口示例信息************************
//所有的请求全部统一在这里配置
//get请求示例,带参数
export const getUserInfo = (param) => http.get('url', param.id);
//get请求示例，不带参数
export const getUserList = () => http.get('url');
//post请求示例 带参数
export const validateLoginApi = (data) => http.post('validateLogin', data);
//post请求示例 不带参数
export const userlogout = () => http.post('url');
//建议使用的方法
//将post对象封装在一个form对象里，直接将对象作为参数传入
export const doMothed = (form) => http.post('url', form);

/***********************************************************
 * 用户模块
 */
//用户登录
export const loginUser = (data) => http.post('loginUser', data);
//注册用户前发送验证码方法
export const sendRegCode = (data) => http.post('sendcode',data);
//注册用户
export const regUser = (data) => http.post('regUser',data);
//忘记密码重置前发送验证码
export const sendResetCode = (data) => http.post('sendreset',data);
//忘记密码重置用户密码
export const resetUserPass = (data) => http.post('resetUserPass',data);
//获取用户动态信息
export const getUserInfoByUserId = (data) => http.post('getInfoByUserId',data);
//编辑用户个人信息
export const EditPersonalInfo = (data) => http.postFile('EditPersonalInfo',data);
//用户信息认证
export const updateUserAuth = (data) => http.post('updateUserAuth',data);
//认证成功后重新加载当前用户信息
export const getReloadUserInfoByUserId = (data) => http.post('getUserInfoByUserId',data);

/**
 * 用户消息模块
 */
//获取用户未读的消息数据
export const getNotifyNotRead = (data) => http.post('getNotifyNotRead',data);
//获取用户所有消息数据
export const getAllNotifyListByUserId = (data) => http.post('getNotifyMapperDataByCurrentUserId',data);
//获取@用户的消息数据
export const getNotifyMapperDataATCurrentUserId = (data) => http.post('getNotifyMapperDataATCurrentUserId',data);
//获取与用户互动的消息数据
export const getNotifyMapperDataHDCurrentUserId = (data) => http.post('getNotifyMapperDataHDCurrentUserId',data);

/**
 * 用户粉丝模块
 */
//获取认证的粉丝用户列表
export const getAuthFansUserListMapperDataByUserId = (data) => http.post('getAuthFansUserListMapperDataByUserId',data);
//获取粉丝用户列表
export const getFansUserListMapperDataByUserId = (data) => http.post('getFansUserListMapperDataByUserId',data);
//获取关注者列表
export const getFoUserListMapperDataByUserId = (data) => http.post('getFoUserListMapperDataByUserId',data);
//获取你认识的关注者列表
export const getYouKnowFoUserListMapperDataByUserId = (data) => http.post('getYouKnowFoUserListMapperDataByUserId',data);

/**
 * 关注交互模块
 */
//查询当前用户是否关注了发帖人
export const getIsFoByCurrentUserId = (data) => http.post('getIsFoByCurrentUserId',data);
//关注用户
export const addUserFoPostUser = (data) => http.post('addUserFoPostUser',data);
//取消关注用户
export const cancelUserFoPostUser = (data) => http.post('cancelUserFoPostUser',data);
//点赞操作
export const addPressXH = (data) => http.post('addPressXH',data);
//取消点赞
export const cancelPressXH = (data) => http.post('cancelPressXH',data);
//查询当前用户是否对当前帖子进行了转发和点赞，查询状态
export const getPostRelationByPostIdAndCurrentUserId = (data) => http.post('getPostRelationByPostIdAndCurrentUserId',data);

/**
 * 贴文功能模块
 */
//用户发布新帖子（支持图片与视频上传）
export const addPostHandler = (data) => http.postFile('addPostHandler',data);
//用户快速转发帖子
export const addQuickZF = (data) => http.post('addQuickZF',data);
//用户取消快速转发帖子
export const cancelQuickZF = (data) => http.post('cancelQuickZF',data);
//加载为你推荐帖子列表请求
export const getForYouData =(data) => http.post('getForYouData',data);
//获取当前用户关注人的帖子列表
export const getCurrentUserFoUserPostDataList = (data) => http.post('getCurrentUserFoUserPostDataList',data);
//根据当前用户id删除帖子
export const delPostByUserId =(data) => http.post('delPostByUserId',data);
//通过zf_parent_id查询转发帖子内容
export const getZFPostInfoByPostId = (data) => http.post('getZFPostInfoByPostId',data);
//根据用户id查询其喜欢的帖子列表
export const getUserLikePostDataMapperByUserId = (data) => http.post('getUserLikePostDataMapperByUserId',data);
//根据用户id查询其所有帖子数据
export const getUserPostDataByUserId = (data) => http.post('getUserPostDataByUserId',data);
//根据用户id查询其多媒体内容帖子数据
export const getUserMediaPostDataMapperByUserId = (data) => http.post('getUserMediaPostDataMapperByUserId',data);
//根据用户id查询其回复的帖子数据
export const getUserReplyPostDataMapperByUserId = (data) => http.post('getUserReplyPostDataMapperByUserId',data);
//通过查询关键字搜素帖子
export const getPostSearchDataMapperByQuery = (data) => http.post('getPostSearchDataMapperByQuery',data);
//根据帖子id查询回复的父帖子内容
export const getPostParentByPostId = (data) => http.post('getPostInfoByPostId',data);

/**
 * 热搜模块
 */
//获取最新热搜列表（TOP 10）
export const getHotSearchList =() => http.post('getHotSearchList');

/**
 * 推荐模块
 */
//根据当前用户id推荐其可以关注的用户列表
export const getRecommendUserList = (data) => http.post('getRecommendUserList',data);

/**
 * 国际化模块
 */
//通过区域查询加载国际化信息
export const getGlobalLanguageByArea = (data) => http.post('getGlobalLanguageByArea', data);
//获取国际化列表
export const getGlobaLanguageList = (data) => http.post('getGlobaLanguageList', data);

/**
 * 第三方接口模块
 */
//获取当前用户的外网IP地址
export const getCurrentUserIP = () => http.get('https://api.ipify.org');
//通过ip地址信息查询当前用户详细地理位置信息
export const getDetailsUserGlobalInfo =(ip)=>http.get('http://ip-api.com/json/' + ip + '?lang=zh-CN');
//在线翻译接口（百度API）
//这里不是所有地方全用了该封装接口，帖子详细页面翻译会出现异常
export const baiduTranslateAPI = (params) => {
    return jsonp('https://fanyi-api.baidu.com/api/trans/vip/translate',params)
} ;


